vacuum2 2.2.1
Loading...
Searching...
No Matches
Vacuum 2 Click Driver

API for configuring and manipulating Vacuum 2 Click driver. More...

Topics

 Vacuum 2 Settings
 Settings of Vacuum 2 Click driver.
 Vacuum 2 MikroBUS Map
 MikroBUS pin mapping of Vacuum 2 Click driver.

Functions

void vacuum2_cfg_setup (vacuum2_cfg_t *cfg)
 Vacuum 2 configuration object setup function.
void vacuum2_drv_interface_sel (vacuum2_cfg_t *cfg, vacuum2_drv_t drv_sel)
 Vacuum 2 driver interface setup function.
err_t vacuum2_init (vacuum2_t *ctx, vacuum2_cfg_t *cfg)
 Vacuum 2 initialization function.
err_t vacuum2_read_adc_raw (vacuum2_t *ctx, uint16_t *raw_adc)
 Vacuum 2 read raw ADC value function.
err_t vacuum2_read_adc_voltage (vacuum2_t *ctx, float *voltage)
 Vacuum 2 read voltage level function.
err_t vacuum2_set_vref (vacuum2_t *ctx, float vref)
 Vacuum 2 set vref function.
err_t vacuum2_read_vout (vacuum2_t *ctx, float *vout)
 Vacuum 2 read vout function.
err_t vacuum2_read_vout_avg (vacuum2_t *ctx, uint16_t num_conv, float *vout_avg)
 Vacuum 2 read vout avg function.
err_t vacuum2_calib_offset (vacuum2_t *ctx)
 Vacuum 2 calib offset function.
err_t vacuum2_read_pressure (vacuum2_t *ctx, int16_t *pressure)
 Vacuum 2 read pressure function.

Detailed Description

API for configuring and manipulating Vacuum 2 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ vacuum2_calib_offset()

err_t vacuum2_calib_offset ( vacuum2_t * ctx)

Vacuum 2 calib offset function.

This function calibrates the zero current offset value.

Parameters
[in]ctx: Click context object. See vacuum2_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function should only be called when no pressure is applied to the sensor.

◆ vacuum2_cfg_setup()

void vacuum2_cfg_setup ( vacuum2_cfg_t * cfg)

Vacuum 2 configuration object setup function.

This function initializes Click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See vacuum2_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ vacuum2_drv_interface_sel()

void vacuum2_drv_interface_sel ( vacuum2_cfg_t * cfg,
vacuum2_drv_t drv_sel )

Vacuum 2 driver interface setup function.

This function sets a serial driver interface which will be used further in the Click driver.

Parameters
[out]cfg: Click configuration structure. See vacuum2_cfg_t object definition for detailed explanation.
[in]drv_sel: Driver interface selection. See vacuum2_drv_t object definition for detailed explanation.
Returns
Nothing.
Note
This driver selection should be called before init function to configure the driver to work with the serial interface which is consistent with the real state of the hardware. If this function is not called, the default driver interface will be set.

◆ vacuum2_init()

err_t vacuum2_init ( vacuum2_t * ctx,
vacuum2_cfg_t * cfg )

Vacuum 2 initialization function.

This function initializes all necessary pins and peripherals used for this Click board.

Parameters
[out]ctx: Click context object. See vacuum2_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See vacuum2_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ vacuum2_read_adc_raw()

err_t vacuum2_read_adc_raw ( vacuum2_t * ctx,
uint16_t * raw_adc )

Vacuum 2 read raw ADC value function.

This function reads raw ADC value.

Parameters
[in]ctx: Click context object. See vacuum2_t object definition for detailed explanation.
[out]raw_adc: Output ADC result.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ vacuum2_read_adc_voltage()

err_t vacuum2_read_adc_voltage ( vacuum2_t * ctx,
float * voltage )

Vacuum 2 read voltage level function.

This function reads raw ADC value and converts it to proportional voltage level.

Parameters
[in]ctx: Click context object. See vacuum2_t object definition for detailed explanation.
[out]voltage: Output voltage level [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The conversion to voltage depends on the entered reference voltage.

◆ vacuum2_read_pressure()

err_t vacuum2_read_pressure ( vacuum2_t * ctx,
int16_t * pressure )

Vacuum 2 read pressure function.

This function reads the pressure measurement.

Parameters
[in]ctx: Click context object. See vacuum2_t object definition for detailed explanation.
[out]pressure: Pressure level [Pa].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
This function relies on calibrated zero pressure offset, see vacuum2_calib_offset function.

◆ vacuum2_read_vout()

err_t vacuum2_read_vout ( vacuum2_t * ctx,
float * vout )

Vacuum 2 read vout function.

This function reads the sensor output voltage.

Parameters
[in]ctx: Click context object. See vacuum2_t object definition for detailed explanation.
[out]vout: Output voltage level [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ vacuum2_read_vout_avg()

err_t vacuum2_read_vout_avg ( vacuum2_t * ctx,
uint16_t num_conv,
float * vout_avg )

Vacuum 2 read vout avg function.

This function reads a desired number of sensor voltage output samples and averages it.

Parameters
[in]ctx: Click context object. See vacuum2_t object definition for detailed explanation.
[in]num_conv: Number of ADC samples.
[out]vout_avg: Average output voltage level [V].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ vacuum2_set_vref()

err_t vacuum2_set_vref ( vacuum2_t * ctx,
float vref )

Vacuum 2 set vref function.

This function sets the voltage reference for Vacuum 2 Click driver.

Parameters
[in]ctx: Click context object. See vacuum2_t object definition for detailed explanation.
[in]vref: Reference voltage (volts).
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
The default voltage reference set with vacuum2_init is 3.3V.